var PlayLayer05=cc.Layer.extend({
	backgroundLayer : null,
	mainLayar : null,
	tipLayer : null,
	flow:null,
	ctor:function(){
		this._super();
		this.initFrames();
		this.initTeach();
		this.flow = gg.flow;
		this.backgroundLayer=new PlayBackgroundLayer05(this);

		this.mainLayer=new PlayMainLayer05(this,TAG_G5_PLAYMAIN);
		ll.run = this.mainLayer; 
		this.tipLayer=new TipLayer05(this);
		ll.tip = this.tipLayer; 
		this.toolLayer=new ToolLayer05(this);
		ll.tool = this.toolLayer; 
		this.flow.init(this.tipLayer.tip,this.tipLayer.tip_frame, this.tipLayer.flash);
		if(gg.teach_type == TAG_LEAD){
			var fontDef = new cc.FontDefinition();
			fontDef.fontName = "Arial";
			fontDef.fontSize = "32";
			var label=new cc.LabelTTF("请点击闪烁部分进行相应的操作",fontDef);
			label.setPosition(cc.p(gg.c_width, gg.c_height*1.68));
			label.setFontFillColor(cc.color(0,0,0, 0));	
			this.addChild(label);
			label.runAction(cc.sequence(cc.delayTime(3),cc.callFunc(function a(){
				label.setVisible(false);
			},this)));
		}
		this.flow.start();
		this.flow.next();
	},
	initFrames:function(){
		cc.spriteFrameCache.addSpriteFrames(res_play05.play_p);
		cc.spriteFrameCache.addSpriteFrames(res_play05.action_p);
	},
	over:function (){
		this.tipLayer.over();
		this.scheduleOnce(function(){
			ch.gotoFinish(TAG_EXP_05, g_resources_finish05, new FinishScene05());
		},2);
		// 提交成绩
		net.saveScore();
	},
	initTeach:function(){
		// 初始化游戏参数
		gg.begin_time = new Date();
		gg.score = 0;
		gg.errorStep = 0;// 错误步数
		gg.oneSure = 0;// 一次正确的步数
		gg.errFlag = false;
		gg.teachFlow = teachFlow05;
		gg.totalStep = teachFlow05.length;
		gg.flow = new TeachFlow05(this);
	}
});
var PlayScene05=PScene.extend({
	onEnter:function(){
		this._super();
		var layer=new PlayLayer05();
		this.addChild(layer);
	}
});
